package baidu.bms.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author sunqiyuan
 * @Classname Runner
 * @Description TODO
 * @Date 2020/10/14 10:21 上午
 * @Version V1.0
 */
@Component
public class Runner implements CommandLineRunner {
    @Autowired
    CallDemoService callDemoService;

    @Value("${dubbo.application.name}")
    private String serviceName;

    @Override
    public void run(String... args) throws Exception {

        while (true) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    System.out.println(callDemoService.doSayHello());
                    System.out.println("\n\n");

                }
            }).start();
            try {
                Thread.sleep((int) (Math.random() * 10000));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }


    }
}
